import {createRouter, createWebHistory,createWebHashHistory} from 'vue-router'

const router = createRouter({
    history:createWebHashHistory('/'), 
    routes:[
        {
            path: '/',
            name: 'Index',
            meta:{
                title:'首页',
                showLoading:0
            },
            component: () => import('@/views/index/index.vue')
        },
        {
            path: '/login',
            name: 'Login',
            meta:{
                title:'登陆',
                showLoading:0
            },
            component: () => import('@/views/login/index.vue'),
            beforeEnter:async (to, from ,next)=>{
                if(from.name != "Policy"){ // 如果不是从使用协议返回的，清楚缓存
                    sessionStorage.removeItem('inputInfo')
                }
                next()
            }
        },
        {
            path: '/exchange/index',
            name: 'exchangeIndex',
            meta:{
                title:'',
                showLoading:0
            },
            component: () => import('@/views/exchange/index/index.vue')
        },
    ]
})

export default router